<style tyle="text/css">
  .modal-lg {
    width: 80%;
  }
  .color {
    color: #F00;
  }
</style>
<div class="modal-header">
    <h4 class="modal-title">添加产品优惠信息</h4>
</div>
<div class="modal-body">

  <div class="panel" ng-if="status.save">
    <div class="panel-heading">
      <div class="row">
        <div class="col-sm-4 m-b-xs">
          <div class="input-group">
            <div class="input-group-btn"><span class="btn btn-default">产品名称</span></div>
            <input type="text" class="form-control" ng-model="searchform.name">
          </div>
        </div>
        <div class="col-sm-4 m-b-xs">
          <ui-select ng-model="searchform.type" theme="bootstrap">
            <ui-select-match placeholder="请选择产品类型">{{$select.selected.label}}</ui-select-match>
            <ui-select-choices repeat="item.value as item in sale_type | filter: $select.search">
              <span ng-bind-html="item.label | highlight: $select.search"></span>
            </ui-select-choices>
          </ui-select>
        </div>
        <div class="col-sm-2 m-b-xs">
          <button type="button" class="btn btn-info form-control" ng-click="loadProductList()">搜索</button>
        </div>
      </div>
        
    </div>
    <div class="panel-body">
      <table class="table table-striped dataTable table-condensed tree_table">
        <thead>
          <tr>
            <th style="width: 3%" class="text-center">
              <label class="i-checks m-b-none">
                <input type="checkbox" ng-model="status.all" ng-click="allSelect()"><i></i>
              </label>
            </th>
            <th class="col-md-3 text-center">产品名称</th>
            <th class="col-md-1 text-center">产品编号</th>
            <th class="col-md-3 text-center">价格</th>
            <th class="col-md-2 text-center">产品分类</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="info in discount_list">
            <td class="text-center">
              <label class="i-checks m-b-none">
                <input type="checkbox" ng-model="info.state" ng-click="selectOne(info)"><i></i>
              </label>
            </td>
            <td class="text-center">{{info.name}}</td>
            <td class="text-center">{{info.code}}</td>
            <td class="text-center">市场价:{{info.market_price}} / 指导价:{{info.guide_price}}</td>
            <td class="text-center">{{info.sale_category_name}}</td>
          </tr>
        </tbody>
      </table>
      <div class="text-right" style="background-color: white">
        <pagination total-items="totalItems" ng-model="currentPage" ng-change="loadProductList(currentPage)" previous-text="上一页"
          next-text="下一页" first-text="首页" last-text="尾页" max-size="5" boundary-links="true" rotate="false"
          items-per-page="itemsPerPage" class="pagination pagination-sm m-t-none m-b-none"></pagination>
      </div>
      <div style="padding-right: 5px; padding-bottom: 5px; float: left;"  ng-repeat="info in save_list">
        <button class="btn btn-sm btn-info">{{info.name}}
          <i class="glyphicon glyphicon-remove" ng-click="remove($index)"></i>
        </button>
      </div>
    </div>
  </div>

  <div class="panel" ng-if="!status.save">
    <div class="panel-body">
      <table class="table table-striped dataTable table-condensed tree_table">
        <thead>
          <tr>
            <th class="col-md-2 text-center">产品名称</th>
            <th class="col-md-1 text-center">产品编号</th>
            <th class="col-md-2 text-center">价格</th>
            <th class="col-md-1 text-center">优惠类型</th>
            <th class="col-md-1 text-center">优惠信息</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="info in save_list" ng-class="{'color': info.nopass}">
            <td class="text-center">{{info.name}}</td>
            <td class="text-center">{{info.code}}</td>
            <td class="text-center" name="market_price">市场价:{{info.market_price}} / 指导价:{{info.guide_price}}</td>
            <td class="text-center">
              <select ng-model="info.discount_type" ng-change="check(info)">
                <option value="1">打折优惠</option>
                <option value="2">减价优惠</option>
              </select>
            </td>
            <td class="text-center">
              <input type="number" ng-model="info.price" style="margin-right: 5px" ng-keyup="check(info)">
              {{info.discount_type==1?'%':'元'}}
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>


</div>
<div class="modal-footer" ng-if="status.save">
    <button class="btn btn-success" type="button" ng-click="ok()">下一步</button>
    <button class="btn btn-danger" type="button" ng-click="cancel()">取消</button>
</div>
<div class="modal-footer" ng-if="!status.save">
    <button class="btn btn-success" type="button" ng-click="save()">确定</button>
    <button class="btn btn-danger" type="button" ng-click="back()">返回</button>
</div>
